//
//  FSWHelperTool.h
//  HMT-APP
//
//  Created by 伏圣文 on 2017/8/25.
//  Copyright © 2017年 LXC. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AppDelegate.h"
typedef enum
{
    //默认时间戳转date
    TimeStampToDate  = 0,
    //date转时间戳
    DateToTimeStamp
} TimeStampOrDate;

typedef enum
{
    //指定时间之后
    DateTimeDayAfter  = 0,
    //指定时间之前
    DateTimeDayBefore
} DateTimeDayBAType;


@interface FSWHelperTool : NSObject

#pragma mark - 字符串相关
/**
 *  银行卡正则验证
 *
 *  @param bankCardNumber 银行卡号
 *
 *  @return Bool结果
 */
+ (BOOL) validateBankCardNumber: (NSString *)bankCardNumber;
/**
 判断字符串是否位空
 @param inputString 输入字符串
 @returns 返回结果
 */
+(BOOL)stringNullOrEmpty:(NSString *)inputString;

/**
 判断字符串是否为数字
 @param inputString 输入字符串
 @returns 返回结果
 */
+(BOOL)stringNotNumber:(NSString *)inputString;

/*
 判断字符串的每个字符是否为数字或字母
 @param string 输入字符串
 @returns 返回结果
 */
+(BOOL)containInvalidChar:(NSString *)string;

/*
 判断字符串是否为金额格式
 **/
+(BOOL)stringIsAmt:(NSString *)string;

/*
 判断字符串是否为中文
 */
+(BOOL)isChinese:(NSString*)string;

/**
 *  判断字符串含中文
 */
+(BOOL)isHaveChinese:(NSString *)string;

/**
 *  判断是否包含表情符号
 */
+ (BOOL)isContainsEmoji:(NSString *)string;

/**
 *  拆分字符串为数组
 */
+(NSMutableArray *)getArrWithStr:(NSString *)valueStr;
/**
 *  拆分字符串为数组
 */
+(NSArray *)getArrWithStr:(NSString *)valueStr andKeyStr:(NSString *)keyStr;
#pragma mark - 判断手机号码格式是否正确
+ (BOOL)isValidTelNum:(NSString *)telNum;
/*
 判断身份证件号是否符合规则
 */
+(BOOL)isValidCertId:(NSString *)string;

#pragma mark 字符串金额处理
/*
 处理金额显示
 当输入金额为XXXXX.XX的格式时，小数点前的每三位加入一个逗号，分隔符,
 修改后的格式为: XX,XXX,XXX.XX 格式
 */
+(NSString *)processAmtDisplay:(NSString *)amtSTR;

/**
 *  判断是否已成年
 */
+ (BOOL)isManhoodWithCertID:(NSString *)certID;


/** 判断是否是中文用户名 */
+ (BOOL)validateNickname:(NSString *)nickname;

/** 判断是否是正整数 */
+ (BOOL)isPositiveInteger:(NSString *)number;

/** 字符串前面添加空格 */
+ (NSString *)addSpace:(NSString *)string count:(int)count;

/** 将金额字段转换为货币格式 */
+ (NSString *)convertToCurrencyWith:(NSString *)String;

/** 数组转json字符串 */
+ (NSString*)arrayToJson:(NSArray *)arr;
+ (NSString*)modelToJson:(id)model;
/** 字典转json字符串 */
+ (NSString*)dictionaryToJson:(NSDictionary *)dic;

/** json字符串转字典 */
+ (NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString;

// model模型转字典 实现代码

+(NSDictionary*)dicFromObject:(NSObject*)object;

/** 验证两位小数的字符串 */
+ (BOOL)validateMoneyFormat:(NSString *)moneyStr;
/** 登录密码验证 */
+(BOOL)checkLoginPassWord:(NSString *)password;
//根据身份证号获取生日
+(NSString *)birthdayStrFromIdentityCard:(NSString *)numberStr;

//根据身份证号性别
+(NSString *)getIdentityCardSex:(NSString *)numberStr;

//根据省份证号获取年龄
+(NSString *)getIdentityCardAge:(NSString *)numberStr;
//判断是是否是六位数字
+ (BOOL)isPostCode:(NSString *)number;

/**
 *
 *String中过滤HTML标签
 *方法2
 */
+(NSString *)removeHTML2:(NSString *)html;
/**
 *
 *String中过滤HTML标签
 *方法1
 */
+(NSString *)removeHTML:(NSString *)htm;
//隐藏手机号
+(NSString *)mobileHide:(NSString *)mobile;

/**
 *
 *时间戳 与 字符串 互转
 */
+(NSString *)getDateString:(NSString *)numberStr withToTyp:(TimeStampOrDate)toType withStringType:(NSString *)stringType;
//时间戳转字符串
+(NSString *)getMonthString:(NSString *)numberStr withStringType:(NSString *)stringType;
+(NSString *)getMonthTimeString:(NSString *)numberStr withStringType:(NSString *)stringType;
+(NSDate *)getStringData:(NSString *)numberStr withToTyp:(TimeStampOrDate)toType withStringType:(NSString *)stringType;
/**
 base64 解码
 */
+(NSString *)getStringBaseEncoding:(NSString *)string;
+(NSString *)getBaseToArrayEncoding:(NSString *)string;
+(NSString *)getBaseStringEncoding:(NSString *)string;
+(NSDictionary *)getBaseEncoding:(NSString *)string;
+(NSDictionary *)getBaseDictionaryEncoding:(NSString *)string;
+(NSDictionary *)getBaseddddDictionaryEncoding:(NSString *)string;
+(NSString *)base64EncodedString:(NSDictionary *)dict;
+(NSString *)base64ArrayEncodedString:(NSArray *)array;

+(NSMutableAttributedString *)textStrLastColor:(NSString *)str andColor:(UIColor *)color andFontSize:(float)size andLength:(NSInteger)length;
#pragma mark -- 判断字符串中是否含有某个字符串
+ (BOOL)stringRoaldSearch:(NSString *)str withString:(NSString*)title;

+(BOOL)isFringe;

/**
 *
 *获取当前时间 dateFormats时间格式
 */
+(NSDate*)getCurrentTimes;
+(NSString*)getCurrentTimes:(NSString *)dateFormat;

//字符串时间转date
+(NSDate*)getNowTimeTimestamp:(NSString *)dateStr;
/**
 *
 获取当前时间戳有两种方法(以秒为单位)
 */

+(NSString *)getNowTimeTimestamp;
//字符串时间转字符串
+(NSString *)getStringToStringTimestamp:(NSString *)dateStr andFormatter:(NSString *)format;
//字符串时间转date
+(NSDate*)getStrToDate:(NSString *)dateStr andFormatter:(NSString *)format;
//date转字符串时间
+(NSString*)getDateToStr:(NSDate *)date andFormatter:(NSString *)format;
/**
 *时间比较 返回1 - 过期, 0 - 相等, -1 - 没过期
 */
+ (int)compareOneDay:(NSDate *)oneDay withAnotherDay:(NSDate *)anotherDay;
//时间比较
+ (int)compareOneDay:(NSString *)oneDay withAnotherDay:(NSString *)anotherDay andDateFormat:(NSString *)dateFormat;
//指定日期是周几
+ (NSString*)weekDayStr:(NSString*)format;
//指定日期是周几
+ (NSInteger)weekDayInt:(NSString*)format;
//获取前月的第一天与最后一天
+ (NSArray *)getMonthFirstAndLastDayWith:(NSString *)dateStr;

//获取日期date对应月的第一天日期
+ (NSString *)getMonthFirstDayWithDate:(NSDate *)date format:(NSString *)aformat;
//获取日期date对应月的最后一天日期
+ (NSString *)getMonthLastDayWithDate:(NSDate *)date format:(NSString *)aformat;
//获取前周的第一天与最后一天
+ (NSArray *)getZhouLastDayWithDate;

//获取单个年月日
+(NSString *)getDataOneYearOrMonthOrDay:(NSInteger)number;
//获取指定日期的单个年月日
+(NSString *)getDataOneYearOrMonthOrDay:(NSDate *)datetime andNumber:(NSInteger)number ;
//获取指定日期的单个年月日 无0
+(NSString *)getNoODataOneYearOrMonthOrDay:(NSDate *)datetime andNumber:(NSInteger)number;
//获取时间差
+ (float)pleaseInsertStarTime:(NSString *)starTime andInsertEndTime:(NSString *)endTime andType:(NSInteger)type andFormat:(NSString *)format;
//指定时间的前几天或者后几天
+(NSString *)getBeforeOrAfterDate:(NSString *)datetime andFormat:(NSString *)formet andBAType:(DateTimeDayBAType)type andDay:(int)day;
//替换指定字符串
+(NSString *)stringByReplacingOccurrencesOfString:(NSString *)oldStr andStartStr:(NSString *)startStr andEndStr:(NSString *)endStr;
/**
 *判断字符串是否为空
 */
+  (BOOL) isBlankString:(NSString *)string;
//nil to ""
+(NSString *)isBlankToString:(NSString *)string;
//nil to "0"
+(NSString *)isBlankTo0String:(NSString *)string;
//nil to str
+(NSString *)isBlankToString:(NSString *)string andToString:(NSString *)tostr;
/**
 *获取url中指定字符串
 */
+(NSString *)fromUrlGetAppoint:(NSString *)urlString andAppointStr:(NSString *)appoint;

/**
 *去除<br><P>标签
 */
+(NSString *)stringHtmlBrClear:(NSString *)str;
@end
